package cn.djb.day3;

/**
 * 请实现一个函数，把字符串 s 中的每个空格替换成"%20"。
 */
class Solution1V2 {

    public String replaceSpace(String s) {
        String replace = "%20";
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c ==' '){
                builder.append(replace);
            }else {
                builder.append(c);
            }
        }


        return builder.toString();

    }
}